﻿using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NS
{
    [HotUpdate]
    [Description("填写基本信息1688辅助属性，把1688页签ID携带到基本信息")]
    public class DataChange1688 : AbstractDynamicFormPlugIn
    {
        public override void DataChanged(DataChangedEventArgs e)
        {
            base.DataChanged(e);
            if (e.Field.Key.Equals("F_WNEG_Text_apv"))
            {
                string F_WNEG_Text22 = "", F_WNEG_Text_apv="", F_WNEG_Text23="";
                
                F_WNEG_Text_apv = Convert.ToString(this.Model.GetValue("F_WNEG_Text_apv"));
                var entityRow = this.View.Model.GetEntryRowCount("F_WNEG_Entity");
                if(entityRow!=0)
                {
                    for(int i=0;i<entityRow;i++)
                    {
                        F_WNEG_Text22 = Convert.ToString(this.Model.GetValue("F_WNEG_Text22", i));
                        if (F_WNEG_Text22 == F_WNEG_Text_apv)
                        {
                            F_WNEG_Text23 = Convert.ToString(this.Model.GetValue("F_WNEG_Text23", i));
                            this.Model.SetValue("F_WNEG_Text19", F_WNEG_Text23);
                        }
                    }
                }
            }
        }
    }
}
